package com.mapper;

import com.javabean.Users;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UsersMapper {
    @Select("select * from users where username=#{arg0} and password=#{arg1} and status=1")
    Users selectByUsernameAndPassword(String username,String password);


    List<Users> selectAll();


    int insertUsers(Users users);

    @Insert("insert into users_role (userId,roleId) values (#{userId},#{roleId})")
    int insertU_R(@Param("userId") int userId, @Param("roleId")int roleId);

    @Delete("delete from users where id=#{id}")
    int deleteById(int id);


    Users selectById(int id);

    @Update("update users set email=#{email},username=#{username},password=#{password},phoneNum=#{phoneNum},status=#{status} where id=#{id}")
    int updateUsers(Users users);
    @Update("update users_role set roleId=#{arg1} where userId=#{arg0}")
    int updateU_R(int userId,int roleId);

}
